package com.example.core;

import lombok.Data;

import java.io.Serializable;

@Data
public class ResultEntity<T> implements Serializable {
    private String code;
    private String message;
    private T data;

    public ResultEntity() {
    }

    public static ResultEntity OK() {
        return new ResultEntity("0", "request success");
    }

    public static ResultEntity STATUS_MSG(String code, String msg) {
        return new ResultEntity(code, msg);
    }

    public static <T> ResultEntity OK_DATA(T data) {
        return new ResultEntity("0", "request success", data);
    }

    public ResultEntity(String code) {
        this.code = code;
    }

    public ResultEntity(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResultEntity(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


}
